package ar.com.osdepym.agregacionafip.adapters;

import java.io.File;
import java.io.FileFilter;
import java.util.List;

public class ExtensionesFileFilter implements FileFilter {

	private List<String> okFileExtensions;
	
	public ExtensionesFileFilter(List<String> extensionesValidas) {
		this.okFileExtensions = extensionesValidas;
	}

	public boolean accept(File file) {
		for (String extension : okFileExtensions) {
			if ((file.getName().indexOf(".") == -1) || (file.getName().toLowerCase().endsWith(extension))) {
				return true;
			}
		}
		return false;
	}
}
